Component({
  options: {

  },
  /**
   * 组件的属性列表
   */
  properties: {
    // orderList: {
    //   type: Array,
    //   value: [],
    //   observer: function (e) {


    //   }
    item: {
      type: Object,
      value: {},
      observer: function (newVal, oldVal) {
        const ExpireDate = newVal.changedDate || newVal.goodsDeliveryDate;
        const now = new Date().getTime();
        const expire = new Date(ExpireDate).setHours(23, 59, 59);
        if (now > expire && newVal.deliverStatus == 0) { // 已延期
          this.setData({
            isOverdue: 1
          });
        } else {
          let diff = expire - now;
          if (diff > 0 && diff <= 3 * 24 * 3600 * 1000 && newVal.deliverStatus == 0) {  //即将延期
            this.setData({
              isOverdue: 2
            });
          }
        }

      }

    },
    listIndex: {
      type: Number,
      value: 0,
      observer: function (e) {
      },
    },
    isShare: {
      type: Boolean,
      value: false,
      observer: function (e) {
      },
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    isOverdue: 0
  },

  /**
   * 组件的方法列表
   */
  methods: {
    gotoDetail(e) {
      if (this.data.isShare) {
        wx.navigateTo({
          url: '/pages/share/shareDetail/shareDetail?id=' + e.currentTarget.dataset.id + '&hiddenPrice=' + e.currentTarget.dataset.hiddenPrice
        })
      } else {
        wx.navigateTo({
          url: '/pages/order/orderDetail/orderDetail?id=' + e.currentTarget.dataset.id + '&hiddenPrice=' + e.currentTarget.dataset.hiddenPrice
        })
      }

    }
  }
})